package com.wang.code;

public class ExceptionDemo4_2 {

	public static void main(String[] args) {
		int divide = 0;
		try {
			divide = divide("2","1");
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (ArithmeticException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println(divide);
	}
	
	public static int divide(String n1,String n2) throws ArithmeticException,NumberFormatException,Exception {
		System.out.println("异常发生前代码");
		int divide = 0;
		Integer integer = null;
		integer = new Integer(n1);
		Integer integer2 = new Integer(n2);
		divide = integer/integer2;
		return divide;
	}
}
